package com.mg.service.impl;

import com.google.common.collect.Maps;
import com.mg.mapper.AjaxDao;
import com.mg.service.BaseService;
import com.mg.utils.JsonUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;
import java.util.Map;


@Service("baseService")
public class BaseServiceImpl implements BaseService {
	private Logger logger = LoggerFactory.getLogger(this.getClass());
	@Autowired
	private AjaxDao ajaxDao;

	@Override
	public List<Map<String,Object>> selectList(String sqlKey, String paramStr) {
		Map<String, Object> paramMap = Maps.newHashMap();
		if(!StringUtils.isEmpty(paramStr)){
			paramMap = JsonUtils.toMap(paramStr);
		}
		return ajaxDao.selectList(sqlKey, paramMap);
	}
}
